package com.smartticket.jeju.repository;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

import com.smartticket.jeju.model.Purchase;
import com.smartticket.jeju.model.Sight;

@Component
@Qualifier("purchaseRowMapper")
public class PurchaseRowMapper implements RowMapper<Purchase> 
{
	public Purchase mapRow(final ResultSet rs, final int rowNum) throws SQLException 
	{
		Purchase purchase = new Purchase();
		
		purchase.setId(rs.getInt("id"));
		purchase.setUser_id(rs.getString("user_id"));
		purchase.setTicket_id(rs.getInt("ticket_id"));
		purchase.setCount(rs.getInt("count"));
		purchase.setPurchase_date(rs.getDate("purchase_date"));
		
		return purchase;
	}
}